home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Miscellaneous / CopyPaste 3.3.4 / CopyPaste Tools Sourcecode / Long Date / Long Date.p < prev    next >
Encoding:
Text File  |  1997-06-06  |  1.5 KB  |  68 lines  |  [TEXT/CWIE]

  1. {•This sourcecode is an example for creating a FKey coderesource with•}
  2. {•Metrowerks Pascal. It is copyrighted by Peter Hoerster and released•}
  3. {•for free use in any Shareware or Freeware product as a way to thank all•}
  4. {•programmers who share code snippets. You may put this sources on any•}
  5. {•CD ROM or any Archive Server but you may not sell it. •}
  6.  
  7. {• For comments please write to <hoerster@muenster.de>•}
  8.  
  9.  
  10. unit LongDate;
  11.  
  12. interface
  13.  
  14.     uses
  15.         Types, OSUtils, GestaltEqu, Script, notification, Resources, Events,
  16.          PascalA4, QuickDraw, ToolUtils, Memory, LowMem, Scrap;
  17.  
  18.  
  19.  
  20. {$MAIN}
  21.                         
  22.     procedure main;        
  23.  
  24. implementation
  25.  
  26.     procedure dopaste;
  27.     const
  28.         pastecode=2422;
  29.     var 
  30.         qel: EvQelPtr;
  31.     begin
  32.             if ppostevent(3, pastecode, qel) = noerr then
  33.             qel^.evtqmodifiers := cmdkey;
  34.     end;
  35.  
  36.  
  37.     procedure main;
  38.         var
  39.             oldA4: LongInt;
  40.             myerr: oserr;
  41.             myclipsize, templongint: longint;
  42.             myclipHandle: handle;
  43.             infostring: str255;
  44.  
  45.     
  46.             
  47.     begin
  48.         oldA4 := SetCurrentA4;
  49.         GetDateTime(templongint);
  50.         IUDateString(templongint, longdate, infostring);
  51.         myclipsize:=length(infostring);
  52.         mycliphandle := Tempnewhandle(myclipsize,myerr);
  53.         if myerr=noerr then 
  54.             begin
  55.                 Temphlock(mycliphandle,myerr);
  56.                 if myerr=noerr then 
  57.                     begin
  58.                         blockmove(@infostring[1], mycliphandle^, myclipsize);
  59.                         myerr := ZeroScrap;
  60.                         myerr := putscrap(myclipsize, 'TEXT', myclipHandle^);
  61.                         dopaste;
  62.                     end;
  63.                 Temphunlock(myCliphandle,myerr);
  64.             end;
  65.         TempDisposeHandle(myCliphandle,myerr);
  66.         oldA4 := SetA4(oldA4);
  67.     end;
  68. end.